package com.gm.sys.enums;

/**
 * 系统错误码
 * Created by yangxing on 2017/6/9.
 */
public enum SystemErrorCode {

    success(1, "操作成功"),

    param_null_error(1001,"参数为空错误"),
    username_null_error(1002,"用户名不能为空"),
    password_null_error(1003,"密码不能为空"),
    username_error(1004,"用户名错误"),
    password_error(1005,"密码错误"),
    login_error(1006, "用户名或密码错误");

    private int  code;
    private String name;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static SystemErrorCode getEnumsByCode(int code){
        for(SystemErrorCode enums:SystemErrorCode.values()){
            if(code==enums.getCode()){
                return enums;
            }
        }
        return null;

    }

    private SystemErrorCode(int code, String name) {
        this.code = code;
        this.name = name;
    }
}
